negotiator
Class DiscreteTimeline

java.lang.Object
  extended by negotiator.Timeline
      extended by negotiator.DiscreteTimeline

public class DiscreteTimeline
extends Timeline

Implementation of the timeline in which time is divided in rounds. Time does not pass within a round. Note that requesting the total time is in this case weird.


Nested Class Summary
 
Nested classes/interfaces inherited from class negotiator.Timeline
Timeline.Type
 
Field Summary
 
Fields inherited from class negotiator.Timeline
hasDeadline, paused
 
Constructor Summary
DiscreteTimeline(int totalRounds)
          Creates a timeline with a deadline of totalRounds number of rounds.
 
Method Summary
 double getCurrentTime()
           
 int getOwnRoundsLeft()
          The number of rounds left for ourself.
 int getRound()
          Starting to count from 1, until the total amount of rounds.
 int getRoundsLeft()
           
 double getTime()
          Gets the time, running from t = 0 (start) to t = 1 (deadline).
 int getTotalRounds()
          Be careful, this is not equal to the initializing value!
 double getTotalTime()
          This a hack because in Agent.java a method sleep requires this
 Timeline.Type getType()
           
 void increment()
           
 void pause()
          The DiscreteTimeline does not have to be paused/resumed, as time does not pass within a round.
 void printRoundElapsed()
          Prints time in seconds
 void printTime()
          Prints time, running from t = 0 (start) to t = 1 (deadline).
 void resume()
          The DiscreteTimeline does not have to be paused/resumed, as time does not pass within a round.
 
Methods inherited from class negotiator.Timeline
isDeadlineReached, isPaused
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiscreteTimeline

public DiscreteTimeline(int totalRounds)
Creates a timeline with a deadline of totalRounds number of rounds.

Method Detail

printRoundElapsed

public void printRoundElapsed()
Prints time in seconds


printTime

public void printTime()
Prints time, running from t = 0 (start) to t = 1 (deadline).

Specified by:
printTime in class Timeline

getTime

public double getTime()
Gets the time, running from t = 0 (start) to t = 1 (deadline). The time is normalized, so agents need not be concerned with the actual internal clock. Please use Agent#wait(double) for pausing the agent.

Specified by:
getTime in class Timeline
Returns:
current time in the interval [0, 1].

increment

public void increment()

pause

public void pause()
The DiscreteTimeline does not have to be paused/resumed, as time does not pass within a round.

Overrides:
pause in class Timeline

resume

public void resume()
The DiscreteTimeline does not have to be paused/resumed, as time does not pass within a round.

Overrides:
resume in class Timeline

getTotalTime

public double getTotalTime()
This a hack because in Agent.java a method sleep requires this

Specified by:
getTotalTime in class Timeline
Returns:
amount of time in seconds, or amount of rounds depending on timeline type.

getRound

public int getRound()
Starting to count from 1, until the total amount of rounds.


getRoundsLeft

public int getRoundsLeft()

getTotalRounds

public int getTotalRounds()
Be careful, this is not equal to the initializing value!


getOwnRoundsLeft

public int getOwnRoundsLeft()
The number of rounds left for ourself.


getType

public Timeline.Type getType()
Overrides:
getType in class Timeline
Returns:
type of time: Type.Time or Type.Rounds.

getCurrentTime

public double getCurrentTime()
Specified by:
getCurrentTime in class Timeline
Returns:
amount of seconds passed, or amount of rounds passed depending on the timeline type.